package com.program.cloudmanagesystem.hotel.controller;
import com.program.cloudmanagesystem.hotel.domain.*;
import com.program.cloudmanagesystem.hotel.service.HumanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//import javax.jws.WebParam;
//import javax.jws.soap.SOAPBinding;
import java.util.List;
@RestController
@RequestMapping("/Human")
public class HumanController {
    @Autowired
    private HumanService humanService;

    @GetMapping("/Human")
    public List<Human> showHumen(){
        return humanService.showHumen();
    }

    @GetMapping("/searchHuman")
    public Human searchHuman(@RequestBody Human human){
        return humanService.searchHuman(human.getId());
    }

    @PostMapping("/insertHuman")
    public String insertHuman(@RequestBody Human human){
        humanService.insertHuman(human);
        return "OK";
    }

    @PostMapping ("/deleteHuman")
    public String deleteHuman(@RequestBody Human human){
        humanService.deleteHuman(human.getId());
        return "OK";
    }

    @PostMapping("/updateData")
    public String updateData(@RequestBody Human human){
        humanService.updateData(human);
        return "OK";
    }
    @PostMapping("/searchHumanByHotelId")
    public List<Human> searchHumenByHotelId(@RequestBody Hotel hotel){
        return humanService.showHumanByHotelId(hotel.getId());
    }
}
